import java.util.HashMap;
import java.util.Map;


public class P17 {
	private static Map<Integer, String> map = new HashMap<Integer, String>();
	
	static {
		map.put(1,	"one");
		map.put(2,	"two");
		map.put(3,	"three");
		map.put(4,	"four");
		map.put(5,	"five");
		map.put(6,	"six");
		map.put(7,	"seven");
		map.put(8,	"eight");
		map.put(9,	"nine");
		map.put(10,	"ten");
		map.put(11,	"eleven");
		map.put(12,	"twelve");
		map.put(13,	"thirteen");
		map.put(14,	"fourteen");
		map.put(15,	"fifteen");
		map.put(16,	"sixteen");
		map.put(17,	"seventeen");
		map.put(18,	"eighteen");
		map.put(19,	"nineteen");
		map.put(20,	"twenty");
		map.put(30,	"thirty");
		map.put(40,	"forty");
		map.put(50,	"fifty");
		map.put(60,	"sixty");
		map.put(70,	"seventy");
		map.put(80,	"eighty");
		map.put(90,	"ninety");
		map.put(100,"hundred");
		map.put(1000,"thousand");
	}
	
	public static String getWord(int i) {
		String numString = String.valueOf(i);
		String num = map.get(i);
		int unit = (int) Math.pow(10, numString.length() - 1);
		
		if (num != null) {
			if (numString.length() <= 2) {
				return num;
			} else {
				return "one " + num;
			}
		} else {
			if (numString.length() == 2) {
				return map.get(i - i%unit) + " " + map.get(i%10);
			} else if (numString.length() == 3) {
				String n = map.get(i/unit) + " " + map.get(unit);
						
				if (i%unit != 0) {
					n += " " + "and " + getWord(i%unit);
				}
				
				return n;						
			} else {
				String n = map.get(i/unit) + " " + map.get(unit);
				
				if (i%unit != 0) {
					n += " " + getWord(i%unit);
				}
				return n;
			}
		}
	}
	
	public static void main(String[] args) {
		int sum = 0;
		for (int i = 1; i <= 1000; i++) {
			sum += getWord(i).replaceAll(" ", "").length();
		}
		System.out.println(sum);
	}
}
